package qeb.handheldmedical.patient;

import qeb.handheldmedical.R;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.ImageView;
import android.widget.TextView;
import qeb.handheldmedical.model.InPatient;

;

public class InPatientDetail extends Activity {

	InPatient ip = new InPatient();
	private TextView txtName;
	private TextView txtKsName;
	private TextView txtZysj;
	private TextView txtZd;
	private TextView txt_Close;
	private ImageView iv_mm_xtjl;
	private ImageView iv_mm_jcbg;
	private ImageView iv_mm_smtz;
	private ImageView iv_mm_jybg;
	private ImageView iv_mm_ssjl;
	private ImageView iv_mm_hzjl;
	private ImageView iv_mm_hzxx, img_mm_ryjl;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		super.onCreate(savedInstanceState);
		setContentView(R.layout.inpatient_detail);
		// tv_title=(TextView)findViewById(R.id.tv_top_title);
		// ip = (InPatient)getIntent().getSerializableExtra("patientInfo");
		// tv_title.setText(ip.patient_ch+" "+ip.patient_xm);
		ip = (InPatient) getIntent().getSerializableExtra("patientInfo");
		txtName = (TextView) findViewById(R.id.textView2);
		txtKsName = (TextView) findViewById(R.id.textView3);
		txtName.setText("姓　　名：" + ip.XM);
		txtKsName.setText("科　　室：" + ip.KNAME);
		txtZysj = (TextView) findViewById(R.id.textView4);
		txtZysj.setText("入院时间：" + ip.ZYSJ);
		txtZd = (TextView) findViewById(R.id.textView5);
		txtZd.setText("诊　　断：" + ip.ZD);
		initView();
	}

	private void initView() {
		iv_mm_xtjl = (ImageView) findViewById(R.id.img_mm_xtjl);
		iv_mm_xtjl.setOnClickListener(MyOnClickListener);

		iv_mm_jcbg = (ImageView) findViewById(R.id.img_mm_jcbg);
		iv_mm_jcbg.setOnClickListener(MyOnClickListener);

		iv_mm_smtz = (ImageView) findViewById(R.id.img_mm_smtz);
		iv_mm_smtz.setOnClickListener(MyOnClickListener);

		iv_mm_jybg = (ImageView) findViewById(R.id.img_mm_jybg);
		iv_mm_jybg.setOnClickListener(MyOnClickListener);

		iv_mm_ssjl = (ImageView) findViewById(R.id.img_mm_ssjl);
		iv_mm_ssjl.setOnClickListener(MyOnClickListener);

		iv_mm_hzjl = (ImageView) findViewById(R.id.img_mm_hzjl);
		iv_mm_hzjl.setOnClickListener(MyOnClickListener);

		iv_mm_hzxx = (ImageView) findViewById(R.id.img_mm_hzxx);
		iv_mm_hzxx.setOnClickListener(MyOnClickListener);
		txt_Close = (TextView) findViewById(R.id.txt_Close);
		txt_Close.setOnClickListener(MyOnClickListener);
		img_mm_ryjl = (ImageView) findViewById(R.id.img_mm_ryjl);
		img_mm_ryjl.setOnClickListener(MyOnClickListener);
		/* gestureDetector = new GestureDetector(Home.this,onGestureListener); */
	}

	private OnClickListener MyOnClickListener = new OnClickListener() {
		@Override
		public void onClick(View v) {
			// TODO 自动生成的方法存根
			// Bundle bundle=new Bundle();

			switch (v.getId()) {
			case R.id.img_mm_xtjl:// 病人血糖图片按钮
				final Intent intent_xtjl = new Intent(InPatientDetail.this,
						qeb.handheldmedical.patient.BloodSugarList.class);
				intent_xtjl.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
				intent_xtjl.putExtra("patientinfo", ip);
				InPatientDetail.this.getApplicationContext().startActivity(
						intent_xtjl);
				break;
			case R.id.img_mm_jcbg:// 检查报告图片按钮
				final Intent intent_jcbg = new Intent(InPatientDetail.this,
						qeb.handheldmedical.patient.PacsQuery.class);
				intent_jcbg.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
				intent_jcbg.putExtra("patientinfo", ip);
				InPatientDetail.this.getApplicationContext().startActivity(
						intent_jcbg);
				break;
			case R.id.img_mm_smtz:// 生命体征
				final Intent intent_smtz = new Intent(InPatientDetail.this,
						qeb.handheldmedical.patient.Temperature.class);
				intent_smtz.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
				intent_smtz.putExtra("patientinfo", ip);
				InPatientDetail.this.getApplicationContext().startActivity(
						intent_smtz);
				break;
			case R.id.img_mm_jybg:// 检验报告
				final Intent intent_jybg = new Intent(InPatientDetail.this,
						qeb.handheldmedical.patient.LisQuery.class);
				intent_jybg.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
				intent_jybg.putExtra("patientinfo", ip);
				InPatientDetail.this.getApplicationContext().startActivity(
						intent_jybg);
				break;
			case R.id.img_mm_ssjl:// 手术记录
				final Intent intent_ssjl = new Intent(InPatientDetail.this,
						qeb.handheldmedical.patient.OperationList.class);
				intent_ssjl.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
				intent_ssjl.putExtra("patientinfo", ip);
				InPatientDetail.this.getApplicationContext().startActivity(
						intent_ssjl);
				break;
			case R.id.img_mm_hzjl:// 会诊记录
				final Intent intent_hzjl = new Intent(InPatientDetail.this,
						qeb.handheldmedical.patient.ConsultationQQList.class);
				intent_hzjl.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
				intent_hzjl.putExtra("patientinfo", ip);
				// intent_hzjl.putExtra("consultationState","2");
				InPatientDetail.this.getApplicationContext().startActivity(
						intent_hzjl);
				break;
			case R.id.img_mm_hzxx:// 患者信息
				final Intent intent_hzxx = new Intent(InPatientDetail.this,
						qeb.handheldmedical.patient.InpatientInfo.class);
				intent_hzxx.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
				intent_hzxx.putExtra("patientinfo", ip);
				InPatientDetail.this.getApplicationContext().startActivity(
						intent_hzxx);
				break;
			case R.id.txt_Close:// 关闭
				InPatientDetail.this.finish();
				break;
			case R.id.img_mm_ryjl:// 入院记录
				final Intent intent_ryjl = new Intent(InPatientDetail.this,
						qeb.handheldmedical.patient.PatientRyjl.class);
				intent_ryjl.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
				intent_ryjl.putExtra("patientinfo", ip);
				InPatientDetail.this.getApplicationContext().startActivity(
						intent_ryjl);
				break;
			default:
				break;
			}
		}
	};
}
